                           - 1 -
25-Apr-88 sendfile_doc, sendfile.lis
Document updated 25-Feb-89, 2-Aug-89

Professor Timo Salmi
School of Business Studies
University of Vaasa
P.O. Box 297
SF-65101 Vaasa
Finland


SINCLAIR QL <--> PC FILE TRANSFER
=================================

   Even if this SENDFILE documentation describes file transfers
between the ill-fated  Sinclair  QL  and  a  PC,  much  of  the
information should be of general interest when considering file
transfers between any home computer and a PC.
   For Sinclair  QL  users  this  file  also  contains  a  list
covering a number of my other QL programs starting from page 5.
If you want  to obtain  programs from  the list,  please direct
these requests to the Quanta librarians, not me.

   Two  programs  belong  to   this   set,   SENDFILE_EXE   and
TAKEFILE_EXE, together with this document in SENDFILE_DOC.

   The author  shall not be liable to  the user for any direct,
indirect   or  consequential  loss  arising  from  the  use  or
inability  to use of any program  or file howsoever caused. The
(nominal) fee  for  the  QL  programs  does  not  include  user
support.

   Comments of and contacts with  fellow  Sinclair  QL  and  PC
users  are welcome and encouraged. If  you have the access, you
can try to contact me e.g. at FidoNet node 515/1 (Micro Maniacs
Opus, To: Timo Salmi), or at Internet address:
 ts@chyde.uwasa.fi     (the preferred address)
Bitnet address:
 SALMI@FINFUN.BITNET 


Short Descriptions

SENDFILE_EXE
Sends ascii files from QL ser2_ port to PC. Works with Procomm,
MsKermit,  and Telix  well up  to 9600  bauds. Has  proven very
reliable when you get the PC settings right. Use ascii download
in the PC  end  of  things.  Includes  optional  conversion  of
Scandinavian characters † „ ”  Ž ™ into † „ ”  Ž ™. 

TAKEFILE_EXE
Takes ascii files sent  to ser2_  port from  a PC.  Works  with
Procomm, MsKermit, and Telix, if their settings are right. Baud
rate 300 recommended.  Not  entrely  reliable  because  of  the
technical inadequacy of QL ports. PC optional translation of PC
†„”Ž™ into  corresponding QL characters.

                           - 2 - 

How it Started

   The following  letter, which  I sent  to Quanta  in February
1988, gives the background of SENDFILE_EXE and TAKEFILE_EXE. (I
never  heard about the letter or my catridge after I sent it to
the former Quanta officials.)

   "Finally having had time  for it,  I have  tried my  hand at
transferring data  between Sinclair QL and  a Zenith laptop PC.
Contrary to my fears it turned out easier than expected.
   The physical connection was made between ser2 serial port of
the  QL and COM1 serial port of Zenith. (Don't ask me about the
pins.) To  receive  normal  ascii  files  (not  much  sense  in
transferring  executable QL files to a PC) I used Procomm ascii
downloading. Having  set Zenith  up I  then tried  sending data
from the  QL with QCODE (v4.1)  terminal emulation program, but
the transfer was painstakingly slow, and lost the linefeeds and
Scandinavian characters on the  way.  I  then  tried  the  copy
commands suggested in  Quanta, but got  stuck in the  PC end of
things.
   This was no good.  Next  I  wrote  a  simple  Turbo  Charged
SuperBASIC program,  which writes the source  file to ser2 port
adding  the   linefeeds   and   converting   the   Scandinavian
characters. This transfer  works  quite  well  at  9600  bauds.
Success. Perhaps not the most elegant solution, but it works.
   Transfer in the  other  direction  has  not  been  quite  as
successful (nor as necessary), but manageable, nevertheless. At
1200 bauds  I first set  up a logfile  in the QL  end of things
using QCODE, and  the  applied  Procomm  and  ascii  upload  in
Zenith. This works reasonably. The scandinavian characters must
be converted, though, prior sending.
   I also  attempted writing  a program  for the  QL to  do the
receiving  (reading from  ser2), but  contrary to  sending this
method  turned out to be error-prone. The programs halts sooner
or later to an XMIT error in reading the QL port. Not much harm
done though,  since in PC to QL  transfer QCODE is fast enough,
even if not so in the opposite direction."

... EOL (end of letter) to Quanta ...

   After  that  letter  I  have  (hopefully)  solved  the  file
transfer problem  in  BOTH  directions,  and  the  results  are
sendfile_exe and takefile_exe.
                           - 3 -

SENDFILE_EXE

   Transfer  from QL to PC seems to be quite easy and free from
trouble after you get your system once (con)figured out.
   To  begin with,  connect your  QL ser2_  port with  a proper
cable to the RS232 port  of  your  PC.  Personally,  I  have  a
Miracle  Systems Modaptor in between my QL and PC, but this may
not  be necessary. As to acquiring  or making the proper cable,
you'll  have to consult your dealer,  or at least your manuals.
The most common  pin connections are  given at the  end of this
chapter.
   Call Procomm communications program (or similar) in your PC.
Next set Procomm baud rate at  the  rate  you  intend  to  use.
Usually  the setting 9600,N,8,1 will work,  but you may have to
experiment depending on  your PC.  It is  advisable to  set the
Procomm  software flow control (XON/XOFF) on, and hardware flow
control off.
   Next, invoke ASCII download in Procomm.
   On  your QL apply EXEC_W SENDFILE_EXE. The program will then
ask  you for the file to be sent, the baud rate (make sure that
the same baud  rates  are  used),  and  whether  you  want  the
Scandinavian characters translated.
   The  transfer should now  get under way.  If everything goes
right, the characters sent  are echoed  both on  the QL  and PC
screens. When  the entire  contents of  the file  have emerged,
press ESC on Procomm to close the file on the PC.
   Scandinavian characters pose  a problem  for us  poor Finns,
since  they are in the 8-bit half on the QL and PC ascii codes,
and what is more, not  even  the  same  for  QDOS  and  MS-DOS.
Therefore  † „ ”  Ž and ™ are translated into † „ ”  Ž ™ when
the translation option is  chosen.  If  you  have  to  use  the
Scandinavian  conversion, use Procomm translation table (ALT W)
to convert the latter back into PC Scandinavian characters. The
relevant translations  are  91:142,  92:153,  93:143,  123:132,
124:148, 125:134.
   Two connection diagrams, courtesy of Mr. Antti Ala-Keturi of
the Vaasa University Computer Centre, are given below:

   QL ser2_ 6 pins           PC COM1 25 pins
         1 ----------------------- 7
         2 ----------------------- 3
         3 ----------------------- 2

   QL ser2_ 6 pins           PC AT COM1 9 pins
         1 ----------------------- 5
         2 ----------------------- 2
         3 ----------------------- 3
                           - 4 -

TAKEFILE_EXE

   Transferring data to QL seems  to  be  more  difficult.  The
maximum baud rate which  works is  300 bauds,  and you  have to
pace sending the characters. Proceed as follows.
   Set Procomm  baud  rate  at  300,N,8,1  and  set  "character
pacing" delay to 100 ms in "ascii transfer options".
   Call  EXEX_W TAKEFILE_EXE and give the file name, baud rate,
and whether you want the Scandinavian characters translated. If
the program aborts at this stage (it sometimes will) in an XMIT
error, just call it again.
   On  your PC invoke Procomm upload  option, and use the ascii
upload. If takefile_exe aborts  again,  terminate  the  Procomm
upload  by pressing ESC on the  PC. Call takefile_exe again and
let  it clear the rubbish  from the port, and  then use it once
again. Usually, at least at this stage the system will work (if
not earlier), and you can invoke Procomm upload again.
   The  file is  echoed to  the QL  screen. On  the QL  you can
terminate the  transfer at any  time by pressing  TAB. When the
transfer is  complete, press CTRL Z on  the PC to terminate the
transferred file. Sounds complicated, but it does work.
   Notice, that  if you  terminate the  transfer with  with the
TAB,  there will be some rubbish in  the buffer at the start of
the next  transfer, so it is advisable  to perform a dummy call
of  TAKEFILE_EXE before the next actual transfer. This is easy,
since there is an "again" option in the program.
   In the PC  -->  QL  transfer  the  Scandinavian  translation
should  work without the need  of considering further settings.
(If you  want to delve into  the translation problems, filedump
programs, such  as QL FILEDUMP_EXE and  PC FILEDUMP.EXE, by the
author, may become handy.)
                           - 5 -

Other Library Programs by the Author

23/04/1988 21:17:00

    CASER_EXE            UTILITY        QUANTA LIB_59 DISK_16
Caser  converts names of files into  upper or lower case. Caser
requires a toolkit with a RENAME command, such as Tony Tebby's.
Files  are selected directly  from a directory  menu. Caser can
also be used for selective deleting of files. Can use ramdisk.

    CONDENSE_EXE         UTILITY        QUANTA LIB_35 DISK_12
A  utility to condense SuperBASIC  programs. It removes REMarks
and  deletes REMark-lines  as well  as lines  with a  colon (:)
only.   Furthermore  it  removes  indentations.  The  resultant
program  will be more concise, which is particularly useful for
SUPERCHARGE!

    COPIER_EXE           UTILITY        QUANTA LIB_36 DISK_12 
Organized, interactive copying  from  one  device  to  another.
Contains  several  options  including  ALL  FILES,  NEW  FILES,
UPDATE, AUTOMATIC and SELECTIVE. Files can be copied or moved.

    CRYPTER_EXE          UTILITY        QUANTA DISK_16
For protecting sensitive files  by  rewriting  them  in  secret
code.  User chooses a  password. Same password  both crypts and
decrypts the files. Instructions within the program.

    DIFFE_EXE            UTILITY        QUANTA_LIBRARY
Compares the  contents of two files  and finds the differences.
Includes fast  mode and more tolerant  slow mode. Needs Digital
Precision's Turbo  runtime toolkit  RUNTIME_EXTS or  the actual
toolkit.

    DRAWLINE             GRAPHICS       QUANTA LIB_59 DISK_16
A SuperBASIC program for drawing lines of two variables on grid
drawn  by the program. For a  demonstration of the program, and
the graphical presentation of  a  linear  programming  problem,
merge    DRAWLINE_DEMO   and   follow   the   instructions   in
DRAWLINE_DOC.

    EOLN_EXE             UTILITY        QUANTA LIB_60 DISK_16
Lets  you change the end of marker of a file. Choices are <LF>,
<CR>, and  <LF><CR>. Creates  a new  file leaving  the original
unchanged.  Useful e.g. for certain printers and PASCAL program
development.
                           - 6 -

    FACTORS_EXE          MATH           QUANTA LIB_01 DISK_05
Finds  the factors of an integer. Calculates the largest common
divisor, and the smallest common dividend of two integers.

    FILEADD_EXE          UTILITY        QUANTA DISK_16
Concatenates  two text-files. That is, adds  to the end of each
row of the first file the corresponding row of the second file.
Blanks can be inserted in between. The most obvious application
is making two-column texts. Also see FILETRIM and FILECUT.

    FILECUT_EXE          UTILITY        QUANTA LIB_05 DISK_06
Can  be used to divide large text (not _doc) files into smaller
modules.  Useful e.g. prior transmission in nets. Drops traling
blanks and  special  characters,  and  optionally  omits  blank
lines.

    FILEDUMP_EXE         UTILITY        QUANTA LIB_35 DISK_12
Dumps  the contents of a file on screen in ASCII characters and
ASCII  code numbers simultaneously. Prints ASCII 10 (line feed)
in  colour to highlight the lines of  files. A count is kept at
the same time.

    FILETRIM_EXE         UTILITY        QUANTA AMON DISK_05
For  extracting an optional  range of columns  from a textfile,
optionally  adding a left margin. As  chosen, trims or pads the
right end of each row of a file.

    FIND_EXE             UTILITY        QUANTA DISK_16
Finds a given string from any type of file. Gives the number of
the block  where the string  is found. Useful  as a preliminary
prior  using e.g. Cartridge Doctor patch.  Not very fast. For a
fast, but a less tolerant multifile search use SEARCH_EXE.

    FLAGS_EXE            GAMES/EDUC     QUANTA LIB_36 DISK_12
An  educational game where you are shown national flags and you
have to identify each in turn from a multiple choice list.

    F_FORM               FUNCTION       QUANTA LIB_35 DISK_12
For formatting output. Resembles the missing print using.

    F_USING              FUNCTION       QUANTA LIB_26 DISK_09
A function providing the missing PRINT USING to SuperBASIC. Use
e.g.  statement 110 PRINT F_USING$ ("#####.##", a) to print the
value of the real variable  a  with  two  decimal  places.  See
USING_DOC for more information.
                           - 7 -

    HEXAGAME_EXE         GAMES          QUANTA LIB_57 DISK_02
An  educational version  of the  old number-guessing  game. You
have  to find the  hidden hexadecimal (16-base)  number with as
little  guesses and as  fast as you  can. The game  can also be
played in binary, octal, or the easy decimal (10-base).

    JSFORMAT             UTILITY        QUANTA LIB_59 DISK_16
Formatting problem  cartridges with  automatic RETRY  on format
failed. Works on JS and MGY  versions  of  the  QL.  Uses  WHEN
ERRor. Can also be used on  AH  and  JH  versions  with  manual
RETRY.

    LINEGAME_EXE         GAMES          QUANTA LIB_53 DISK_15
You  have to fit  a line (y=a+kx)  to hit a  number of circles.
Each circle  has a score value inverse  to its size. The player
has three lines  to fit  and the  possibility of  gaining bonus
lines.

    LINPREP_EXE          MATH           QUANTA LIB_35
The  preparation code for solving linear programming and linear
goal    programming   problems.   Documented   in   detail   in
LINSOLVE_DOC. Associated program LINSOLVE_EXE.

    LINSOLVE_EXE         MATH           QUANTA LIB_35 DISK_12
A   solution  code  for  linear  programming  and  linear  goal
programming problems. Documented  in  detail  in  LINSOLVE_DOC.
Associated program LINPREP_EXE.

    LINSOLVE_DOC         MATH/QUILL     QUANTA LIB_35
Quill documentation of the LINSOLVE solutions system for linear
programming  and linear  goal programming  problems. Associated
programs LINPREP_EXE and LINSOLVE_EXE.

    MAKEXE_EXE           UTILITY        QUANTA_LIBRARY
Converts a normal  file into  an executable  file. Can  also be
used to  alter the  dataspace of  an executable  file. Requires
Digital  Precision's RUNTIME_EXTS. See Quanta  5/1987 p. 10 for
the  need of conversions because of  a bug in Micro Peripherals
disk drive.

    MANAGAME_EXE         GAMES/EDUC     QUANTA LIB_36 DISK_12
A management game for one person. Besides being "one more game"
it  serves   as  a   serious  introduction   into  full-fledged
management games used in teaching business students.
                           - 8 -

    PAIVAYS_EXE          CLOCK          QUANTA LIB_01 DISK_05
Multitasking clock giving  the date  in Finnish.  Needs Tebby's
toolkit (sets priority to 1). Run with EXEC (not EXEC_W). There
is also a near version PAIVAYS2_EXE.

    RCOPY                UTILITY        QUANTA AMON DISK_05
RCOPY   copy   command   takes   three   parameters:   source%,
destination%  and filename$. 1=mdv1_, 2=mdv2, 3=fdk1_, 4=fdk2_,
0=scr_. Source = destination allowed,  which  is  handy  for  a
single  diskdrive. Needs CST  ram_bin code. LRUN  RCOPY to load
RCOPY.

    RENUMBER_EXE         UTILITY        QUANTA LIB_60 DISK_16
Renumbers  SuperBASIC files  without the  need of  loading them
into memory. Convenient for program development.

    SEARCH_EXE           UTILITY        QUANTA LIB_60 DISK_16
Searches  for a string through files.  Wildcards can be used to
select the files to be searched for the string.

    SPELLED_EXE          UTILITY        QL_WORLD 
An editor for entering and removing words from dictionaries for
the spelling  checker SPELLER_EXE. Requires  a memory expansion
of 512K.

    SPELLER_EXE          UTILITY        QL_WORLD (`3)
Spelling   checker  for  listed  Quill  and  other  text-files.
Requires a memory expansion  of  512K.  Dictionary  held  in  a
separate  _dny file. Dictionary can be edited with SPELLED_EXE.
A specialized dictionary SPELLED_DNY accompanies the program.

    STATAURU_EXE         STAT           QUANTA LIB_STATPREP
Part of Timo  Salmi's  statistical  package.  Calculates  auto-
correlations  up  to  desired   lag.   Also   calculates   runs
statistics.

    STATDIAG_EXE         STAT           QUANTA LIB_STATPREP
Part   of  Timo  Salmi's  statistical  package.  Draws  scatter
diagrams  of the observations.  User can select  the X-axis and
the Y-axis. If user  provides  the  regression  estimates,  the
program also plots residuals and regressed values on request.

    STATMEAS_EXE         STAT           QUANTA LIB_STATPREP
Part  of Timo Salmi's statistical package. Standard statistical
measures  and frequency diagram for any of the variables in the
data. Measures include minimum, maximum, mean, median, standard
deviation, variance and kurtosis. See also STATPREP_DOC.
                           - 9 -

   STATPREP_EXE          STAT     QUANTA LIB_STATPREP DISK_13
Part  of Timo Salmi's statistical package.  An editor of a kind
used for entering  the  data  for  the  associated  statistical
programs. Maximum  10 variables  with 200  observations (each).
See STATPREP_DOC for further information on the package.

    STATPREP_DOC         STAT/QUILL     QUANTA LIB_STATPREP
Quill   documentation  of  Timo  Salmi's  statistical  package.
Associated  programs STATPREP_EXE,  STATTRAN_EXE, STATMEAS_EXE,
STATRCOR_EXE,  STATAURU_EXE, STATREGR_EXE, STATDIAG_EXE and the
menu driver STATMENU.

    STATRCOR_EXE         STAT           QUANTA LIB_STATPREP
Part  of Timo Salmi's statistical  package. Calculates both the
usual   (Pearson's)   correlation    coefficients    and    the
(non-parametric) Spearman's rank correlation coefficients. Also
gives ranks for the observations of any of the variables.

    STATREGR_EXE         STAT           QUANTA LIB_STATPREP
Part   of  Timo   Salmi's  statistical   package.  Multivariate
regression  on   the  data  prepared   with  STATPREP_EXE  (and
STATTRAN_EXE).

    STATTRAN_EXE         STAT           QUANTA LIB_STATPREP
Part of Timo  Salmi's  statistical  package.  Used  for  making
transformations on  observations  prepared  with  STATPREP_EXE.
Transformations  include taking  logarithms, raising  to power,
taking roots, scaling, and multiplying between observations.

    TRANSLATE_EXE        UTILITY        QUANTA LIB_05 DISK_06
Translates the non-scandinavian characters  †„”Ž™  of  a  text
file into their scandinavian counterparts  †„”Ž™.

TURBOCOPY_EXE            UTILITY        NOT YET IN
Selective  fast copying. Can copy within a single device, which
is  very useful  for single  diskdrive systems.  Loads programs
into memory, and downdoads  then  onto  destination.  Selective
delete incorporated. Caution required because of QDOS bugs.

    TURBODENSE_EXE       UTILITY        QUANTA LIB_26 DISK_09
Another utility to condense  SuperBASIC  programs.  Works  like
CONDENSE_EXE  but is about three times faster. Furthermore does
not delete REMark + and REMark -, which indicate threaded code.

    TYPEVADERS_EXE       GAMES          QUANTA AMON DISK_05
Prevent the  invading characters  from reaching  the right-hand
side  of the screen by typing them. Makes you familiar with the
QL keyboard and fast typing.
                           - 10 -

    TYPE_EXE             UTILITY        QUANTA LIB DISK_15
Displays  file(s)  on   screen.  Wildcards   can  be   used  in
file-names.

    WITPIN_EXE           GAMES          QUANTA LIB_36 DISK_12
A game  of wit where you have to  remove pins from the board by
moving a pin over an adjacent pin.

    WORDLIST_EXE         UTILITY        QUANTA LIB_36 DISK_12
List the words from  any  text-file.  Option  for  alphabetical
order. Useful  for checking the  spelling of a  Quill file. For
bigger files there is a BIGWORDLIST_EXE program available.

